﻿function showKeyCode()
{
    alert("keyCode for the key pressed");
}

function SayiKontrol() 
{  
     if(window.event.keyCode >=65 && window.event.keyCode <=90)
      {  
          alert("Dikkat, Bu kısıma  sadece sayı girilebilir.")  
          window.event.keyCode=35;  
      } 
}

function HarfKontrol()
{
    if(window.event.keyCode >=48 && window.event.keyCode <=57)
    {
        alert("Dikkat,Bu kısıma sadece harf girilebilir");
        window.event.keyCode=35;
    }
}

function BuyukHarf(gelen)
{
    if(window.event.keyCode >=65 && window.event.keyCode <=90)
      { 
        theElement = document.getElementById(gelen);
        theElement.value = theElement.value.toUpperCase();
      }
}
function KucukHarf(gelen)
{
    if(window.event.keyCode >=65 && window.event.keyCode <=90)
      {
        theElement = document.getElementById(gelen);
        theElement.value = theElement.value.toLowerCase();
      }
}

function doBeforePaste(control)
{
    maxLength = control.attributes["maxLength"].value;
    if(maxLength)
    {
    event.returnValue = false;
    }
}
function doPaste(control)
{
    maxLength = control.attributes["maxLength"].value;
    value = control.value;
    if(maxLength)
    {
        event.returnValue = false;
        maxLength = parseInt(maxLength);
        var oTR = control.document.selection.createRange();
        var iInsertLength = maxLength - value.length + oTR.text.length;
        var sData = window.clipboardData.getData("Text").substr(0,iInsertLength);
        oTR.text = sData;
    }
}
function LimitInput(control)
{
    if(control.value.length > control.attributes["maxLength"].value)
    {
        control.value = control.value.substring(0,control.attributes["maxLength"].value);
    } 
}
function NullControl(textid)
{
    var textbox=document.getElementById(textid);
    with (textbox)
    {
      if (value==null||value=="")
      {
      alert("Boş Geçilmez");
      return false;
      }
      else
      {
      return true;
      }
    }
  return true;
}
function addCommas(id)
{
  var valu=document.getElementById(id).value;
  valu+='';
  x=valu.split(',');
  x1=x[0];
  var regx=/(\d{3})(\d{2})/;
  while(regx.test(x1))
  {
   x1=x1.replace(regx,'$1'+'.'+'$2');
  }
  return document.getElementById(id).value=x1;
}

